package au.com.betaversion.service;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;

/**
 * 
 * @author mradochonski
 *
 */
@Service
public class IpServiceImpl implements IpService {

	private static final String CLIENT_IP_HEADER = "X-Cluster-Client-IP";

	@Override
	public String getIp(HttpServletRequest request) {
		String ip = request.getHeader(CLIENT_IP_HEADER);
		if(ip == null)
			ip = request.getRemoteAddr();
		return ip;
	}

}
